package com.yfq.test;

import com.yfq.springframework.core.convert.converter.Converter;

import java.math.BigDecimal;

/**
 * @author 姚凤桥
 * @date 2023/2/13 21:04
 * @description
 */
public class StringToBookConverter implements Converter<String, Book> {
    @Override
    public Book convert(String source) {
        String[] split = source.split("-");

        return new Book(split[0], new BigDecimal(split[1]));
    }
}
